package com.atstudent.gmall.product.controller;

import com.atstudent.gmall.common.result.Result;
import com.atstudent.gmall.common.result.ResultCodeEnum;
import com.atstudent.gmall.product.entity.BaseCategory2;
import com.atstudent.gmall.product.service.BaseCategory2Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 查询二级分类
 * @ClassName：BaseCategory2Controller
 * @Dexcription
 * @Author 薛有朋
 * @CreatDate 2024/11/17 21:18
 **/
@RestController
@RequestMapping(value = "/admin/product")
public class BaseCategory2Controller {

    @Autowired
    private BaseCategory2Service baseCategory2Service;

    /**
     * 查询二级分类
     * @Author 薛有朋
     * @Date 2024/11/23 16:10
     **/
    @GetMapping(value = "/getCategory2/{category1Id}")
    public Result<List<BaseCategory2>> findBaseCategoryByC1Id(@PathVariable(value = "category1Id") Long c1Id){
        List<BaseCategory2> baseCategory2List = baseCategory2Service.findBaseCategoryByC1Id(c1Id);
        return Result.build(baseCategory2List , ResultCodeEnum.SUCCESS);
    }
}
